(defn factorial 
"Computes the factorial of n."
[n]
 (if (< n 0) (throw (Exception. "Cannot find the factorial of a negative number.")))
  (if (zero? n) 1
    (* n (factorial (dec n)))))
    
(def factorial (memoize factorial))